<template>
    <div>
        <h1>axios封装</h1>
        <h1>{{ getuserData }}</h1>
        <h2>============</h2>
        <h1>{{ postuserData }}</h1>

    </div>
</template>
<script>
// 1.导入封装好的axios
import {reqPost,reqGet} from '@/util/request'
export default{
    mounted(){
        reqGet('/zhongbei/userbyid',{
            id:'1'
        }).then(resp =>{
            this.getuserData = resp.data.data
        }).catch(error=>{
            console.error('error data',error)
        });

        reqPost('zhongbei/postUserByUsername',{
            username:'lisi'
        }).then(resp=>{
            this.postuserData = resp.data.data
        }).catch(error=>{
            console.error('error data:',error)
        });

    },

    data(){
        return{
            getuserData:'',
            postuserData:''
        }
    }
}
</script>
